package org.deschutter.hibernate;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * User: Berten De Schutter
 * Date: 01-Oct-2009
 * Time: 13:38:42
 */
@Entity
@Table(catalog = "scimitar", name = "jumpgate")
public class Jumpgate {
    private long id;

    @Id
    @Column(name = "ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    private String x;

    @Basic
    @Column(name = "x")
    public String getX() {
        return x;
    }

    public void setX(String x) {
        this.x = x;
    }

    private String y;

    @Basic
    @Column(name = "y")
    public String getY() {
        return y;
    }

    public void setY(String y) {
        this.y = y;
    }

    private String z;

    @Basic
    @Column(name = "z")
    public String getZ() {
        return z;
    }

    public void setZ(String z) {
        this.z = z;
    }

    private String fleetName;

    @Basic
    @Column(name = "fleet_name")
    public String getFleetName() {
        return fleetName;
    }

    public void setFleetName(String fleetName) {
        this.fleetName = fleetName;
    }

    private long amount;

    @Basic
    @Column(name = "amount")
    public long getAmount() {
        return amount;
    }

    public void setAmount(long amount) {
        this.amount = amount;
    }

    private Integer eta;

    @Basic
    @Column(name = "eta")
    public Integer getEta() {
        return eta;
    }

    public void setEta(Integer eta) {
        this.eta = eta;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Jumpgate jumpgate = (Jumpgate) o;

        if (amount != jumpgate.amount) return false;
        if (eta != jumpgate.eta) return false;
        if (id != jumpgate.id) return false;
        if (fleetName != null ? !fleetName.equals(jumpgate.fleetName) : jumpgate.fleetName != null) return false;
        if (x != null ? !x.equals(jumpgate.x) : jumpgate.x != null) return false;
        if (y != null ? !y.equals(jumpgate.y) : jumpgate.y != null) return false;
        if (z != null ? !z.equals(jumpgate.z) : jumpgate.z != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = (int) (id ^ (id >>> 32));
        result = 31 * result + (x != null ? x.hashCode() : 0);
        result = 31 * result + (y != null ? y.hashCode() : 0);
        result = 31 * result + (z != null ? z.hashCode() : 0);
        result = 31 * result + (fleetName != null ? fleetName.hashCode() : 0);
        result = 31 * result + (int) (amount ^ (amount >>> 32));
        result = 31 * result + eta.intValue();
        return result;
    }

    private JumpgateProbeType jumpgateProbeTypeByTypeId;

    @ManyToOne
    @JoinColumn(name = "type_id", referencedColumnName = "ID")
    public JumpgateProbeType getJumpgateProbeTypeByTypeId() {
        return jumpgateProbeTypeByTypeId;
    }

    public void setJumpgateProbeTypeByTypeId(JumpgateProbeType jumpgateProbeTypeByTypeId) {
        this.jumpgateProbeTypeByTypeId = jumpgateProbeTypeByTypeId;
    }

    private Scans scansByScanId;

    @ManyToOne
    @JoinColumn(name = "scan_id", referencedColumnName = "ID", nullable = false)
    public Scans getScansByScanId() {
        return scansByScanId;
    }

    public void setScansByScanId(Scans scansByScanId) {
        this.scansByScanId = scansByScanId;
    }

    public String toString() {
        return getX() + ":" + getY() + ":" + getZ() + " " + getFleetName() + " " +getEta() + " " +getAmount();
    }
}
